package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 课程表
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Course对象", description="课程表")
public class Course implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "班级id")
    @TableField("classId")
    private Integer classid;
    @TableField(exist = false)
    private String className;
    @TableField(exist = false)
    private Integer classCount;

    @ApiModelProperty(value = "教室id")
    @TableField("classroomId")
    private Integer classroomid;
    @TableField(exist = false)
    private String classroomName;
    @ApiModelProperty(value = "老师id")
    @TableField(" teacherId")
    private Integer  teacherid;
    @TableField(exist = false)
    private String teacherName;
    @ApiModelProperty(value = "授课内容")
    @TableField("subjectContent")
    private String subjectcontent;
    @ApiModelProperty(value = "授课时间1.上午 2.下午")
    @TableField("isForenoon")
    private Integer isforenoon;

    @ApiModelProperty(value = "上课日期")
    private Date date;


    //<editor-fold desc="set 方法">
    public void setClassid(Integer classid) {
        this.classid = classid;
        Class c = Class.classes.get(classid);
        this.className = c.getClassname();
        this.classCount = c.getClassCount();
    }

    public void setClassroomid(Integer classroomid) {
        this.classroomid = classroomid;
        this.classroomName = ClassRoom.classrooms.get(classroomid);
    }

    public void setTeacherid(Integer teacherid) {
        this.teacherid = teacherid;
        this.teacherName = Teacher.teachers.get(teacherid).getTeachername();
    }
    //</editor-fold>

    public Course(Integer classid, Integer classroomid, Integer teacherid, String subjectcontent, Integer isforenoon, Date date) {
        this.classid = classid;
        this.classroomid = classroomid;
        this.teacherid = teacherid;
        this.subjectcontent = subjectcontent;
        this.isforenoon = isforenoon;
        this.date = date;
    }
}
